package com.zg.autoflow.service.impl;

import cn.hutool.core.bean.BeanUtil;
import com.zg.autoflow.req.AutoflowInherentGroupAddReq;
import com.zg.autoflow.req.AutoflowInherentGroupIdsReq;
import com.zg.autoflow.service.AutoflowInherentGroupService;
import com.zg.common.core.dao.Inherent.AutoflowInherentGroup;
import com.zg.common.core.dao.Inherent.dao.AutoflowInherentGroupDao;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
* @author zg
*/
@Service
@RequiredArgsConstructor
public class AutoflowInherentGroupServiceImpl implements AutoflowInherentGroupService {

    private final AutoflowInherentGroupDao autoflowInherentGroupDao;


    @Override
    @Transactional(rollbackFor = Exception.class)
    public AutoflowInherentGroup add(AutoflowInherentGroupAddReq param) {
        //创建对象
        AutoflowInherentGroup obj = new AutoflowInherentGroup();
        //属性处理
        BeanUtil.copyProperties(param, obj);
        StringBuffer strBuff = new StringBuffer();
        obj.setSearchStr(strBuff.toString());
        //保存对象
        autoflowInherentGroupDao.save(obj);
        return obj;
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void del(AutoflowInherentGroupIdsReq idList) {
        autoflowInherentGroupDao.removeBatchByIds(idList.getIdList());
    }

}
